const {data}=require('./mock')
const bodyParser=require('body-parser')

module.exports=app=>{
    app.use(bodyParser.json())
    app.post('/api/list',(req,res)=>{
        let {keys,page}=req.body
        keys=keys*1
        console.log(page)
        const newData=data.filter(item=>item.status===keys)
        res.send({
            code:200,
            total:newData.length,
            data:newData.filter((v,i)=>i<page*10)
        })
    })
}